/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author QUY_THI
 */
@Entity
@Table(name = "Accounts")
@NamedQueries({
    @NamedQuery(name = "Account.findAll", query = "SELECT a FROM Account a"),
    @NamedQuery(name = "Account.findByAcountCode", query = "SELECT a FROM Account a WHERE a.acountCode = :acountCode"),
    @NamedQuery(name = "Account.findByPinCode", query = "SELECT a FROM Account a WHERE a.pinCode = :pinCode"),
    @NamedQuery(name = "Account.findByAccountName", query = "SELECT a FROM Account a WHERE a.accountName = :accountName"),
    @NamedQuery(name = "Account.findByAddress", query = "SELECT a FROM Account a WHERE a.address = :address"),
    @NamedQuery(name = "Account.findByIdentificationCard", query = "SELECT a FROM Account a WHERE a.identificationCard = :identificationCard"),
    @NamedQuery(name = "Account.findByBalance", query = "SELECT a FROM Account a WHERE a.balance = :balance"),
    @NamedQuery(name = "Account.findByStatus", query = "SELECT a FROM Account a WHERE a.status = :status")})
public class Account implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "AcountCode")
    private String acountCode;
    @Basic(optional = false)
    @Column(name = "PinCode")
    private String pinCode;
    @Basic(optional = false)
    @Column(name = "AccountName")
    private String accountName;
    @Basic(optional = false)
    @Column(name = "ADDRESS")
    private String address;
    @Basic(optional = false)
    @Column(name = "IdentificationCard")
    private String identificationCard;
    @Basic(optional = false)
    @Column(name = "Balance")
    private BigDecimal balance;
    @Column(name = "STATUS")
    private Boolean status;
    @OneToMany(mappedBy = "account")
    private List<Deposit> depositList;
    @OneToMany(mappedBy = "account")
    private List<Withdrawal> withdrawalList;
    @OneToMany(mappedBy = "account")
    private List<Transfer> transferList;
    @OneToMany(mappedBy = "account1")
    private List<Transfer> transferList1;

    public Account() {
    }

    public Account(String acountCode) {
        this.acountCode = acountCode;
    }

    public Account(String acountCode, String pinCode, String accountName, String address, String identificationCard, BigDecimal balance) {
        this.acountCode = acountCode;
        this.pinCode = pinCode;
        this.accountName = accountName;
        this.address = address;
        this.identificationCard = identificationCard;
        this.balance = balance;
    }

    public String getAcountCode() {
        return acountCode;
    }

    public void setAcountCode(String acountCode) {
        this.acountCode = acountCode;
    }

    public String getPinCode() {
        return pinCode;
    }

    public void setPinCode(String pinCode) {
        this.pinCode = pinCode;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getIdentificationCard() {
        return identificationCard;
    }

    public void setIdentificationCard(String identificationCard) {
        this.identificationCard = identificationCard;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public List<Deposit> getDepositList() {
        return depositList;
    }

    public void setDepositList(List<Deposit> depositList) {
        this.depositList = depositList;
    }

    public List<Withdrawal> getWithdrawalList() {
        return withdrawalList;
    }

    public void setWithdrawalList(List<Withdrawal> withdrawalList) {
        this.withdrawalList = withdrawalList;
    }

    public List<Transfer> getTransferList() {
        return transferList;
    }

    public void setTransferList(List<Transfer> transferList) {
        this.transferList = transferList;
    }

    public List<Transfer> getTransferList1() {
        return transferList1;
    }

    public void setTransferList1(List<Transfer> transferList1) {
        this.transferList1 = transferList1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (acountCode != null ? acountCode.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Account)) {
            return false;
        }
        Account other = (Account) object;
        if ((this.acountCode == null && other.acountCode != null) || (this.acountCode != null && !this.acountCode.equals(other.acountCode))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Account[acountCode=" + acountCode + "]";
    }

}
